#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

const int N = 1010;
string s[N];
int n;
int ans = 0;
const int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

void dfs(int x, int y) {

    if (s[x][y] == '#') {
        ans ++;
        bool flag = false;
        for (int i = 0; i < 4; ++i) {
            int xx = x + dir[i][0], yy = y + dir[i][1];

            if (xx < 0 || xx >= n || yy < 0 || yy >= n) {
                continue;
            }
            if (s[xx][yy] == '.') {
                flag = true;
                break;
            }
        }
        if (flag) {
            ans --;
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }

    for (int i = 1; i < n; ++i) {
        for (int j = 1; j < n; ++j) {
            dfs(i, j);
        }
    }

    cout << ans;
    return 0;
}